package leoner.multithread4;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;


/**
 * @author kanghui
 *
 */
public class MockController implements Runnable{
	MockMultiThreadService mockService;
	ExecutorService executorService;
	String name;
	int id;
	public MockController(MockMultiThreadService mockService,ExecutorService executorService,String name,int id){
		this.mockService = mockService;
		this.executorService = executorService;
		this.name = name;
		this.id = id;
	}
	public MockController(MockMultiThreadService mockService,String name,int id){
		this.mockService = mockService;
		this.name = name;
		this.id = id;
	}
	public void invokeMultiService(){
		
	}
	public static void main(String[] args) {
//		ExecutorService threadExcutor = Executors.newFixedThreadPool(10);
		MockMultiThreadServiceImpl mockService = new MockMultiThreadServiceImpl();
//		mockService.setThreadExcutor(threadExcutor);
//		MockController c1 = new MockController(mockService,threadExcutor,"kang",9);
//		MockController c2 = new MockController(mockService,threadExcutor,"hui",6);
//		MockController c3 = new MockController(mockService,threadExcutor,"hui",13);
		
		MockController c1 = new MockController(mockService,"kang",9);
		MockController c2 = new MockController(mockService,"hui",6);
		MockController c3 = new MockController(mockService,"hui",13);
		
		new Thread(c1).start();
		new Thread(c1).start();
		new Thread(c1).start();
	}
	
	@Override
	public void run() {
		mockService.m1(id,name);
		mockService.m2(id);
		System.out.println("id:"+id+"   run done");
	}
	
	
}
